package com.hy.mydesktop.client.component.mvc.factory;

import java.util.List;

import com.extjs.gxt.ui.client.mvc.Controller;
import com.hy.mydesktop.client.component.event.AppEvents;
import com.hy.mydesktop.client.component.mvc.controller.meta.WindowControllerModelEnum;
import com.hy.mydesktop.client.component.mvc.factory.util.ControllerFactoryUtil;
import com.hy.mydesktop.client.mvc.form.combobox.ComboBoxController;
import com.hy.mydesktop.client.mvc.form.textfield.TextFieldControler;
import com.hy.mydesktop.shared.persistence.domain.gxt.GxtComponentControllerMetaNodeModel;

/**
 * 
 * <ul>
 * <li>开发作者：花宏宇</li>
 * <li>设计日期：2010-9-19；时间：上午11:17:52</li>
 * <li>类型名称：TextFieldControllerFactory</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
public class ComboBoxControllerFactory {
/**
 * registerEventTypes(AppEvents.DESKTOP_SHORTCUT_ONCLICK_INIT);
 * 1 注册事件
 * 2 handleEvent
 * 
 */
	
	public static Controller createComboBoxController(GxtComponentControllerMetaNodeModel gxtComponentMetaNodeModel){
		
		return configureComboBox(gxtComponentMetaNodeModel);
	}
	
	/**
	 * 
	 * <ul>
	 * <li>方法含义：对窗口的属性进行配置</li>
	 * <li>方法作者：花宏宇</li>
	 * <li>编写日期：2010-9-19；时间：下午上午11:16:37</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 * @param gxtComponentMetaModel
	 * @return
	 */
	private static Controller configureComboBox(GxtComponentControllerMetaNodeModel gxtComponentMetaNodeModel){
		
		ComboBoxController comboBoxController = createDefaultComboBoxController();
		return ControllerFactoryUtil.configureWindow(comboBoxController, gxtComponentMetaNodeModel);

		/*//注册WindowController，需要监听的事件
		if(gxtComponentMetaModel.get(WindowControllerModelEnum.REGISTEREVENTTYPES.name().toLowerCase())!=null){
			
			List<String> appEventCodes = gxtComponentMetaModel.get(WindowControllerModelEnum.REGISTEREVENTTYPES.name().toLowerCase());
			for (String code : appEventCodes) {
				Integer i = Integer.valueOf(code);
				switch (i) {
	            case 1://Integer.valueOf("0001")
	            	comboBoxController.addRegisterEventType(AppEvents.Login);
	            	
	                break;
	            case 2://Integer.valueOf("0002")
	                	
	                break;
	            case 6://Integer.valueOf("0006")
	            	comboBoxController.addRegisterEventType(AppEvents.DESKTOP_WINDOW_INIT);	
	                break;
	            case 7://Integer.valueOf("0007")
	            	comboBoxController.addRegisterEventType(AppEvents.DESKTOP_APPLICATION_INIT);	
	                break;
	            case 8://Integer.valueOf("0008")
	            	comboBoxController.addRegisterEventType(AppEvents.DESKTOP_APPLICATION_RENDER);	
	                break;
	            case 101://Integer.valueOf("0101")
	            	comboBoxController.addRegisterEventType(AppEvents.WINDOW_ININT);
	                break;
	            case 201://Integer.valueOf("0201")
	            	comboBoxController.addRegisterEventType(AppEvents.CONTENTPANEL_ININT);
	                break;
           		           
	            default:
	                break;
		        }
			}
		
		}*/
		
		
		//return comboBoxController;
	}
	
	
	private static ComboBoxController createDefaultComboBoxController(){
		ComboBoxController comboBoxController = new ComboBoxController();
		
		return comboBoxController;
	}
}
